package com.example.mapper;

import com.example.entity.FriendApply;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作friend_apply相关数据接口
*/
public interface FriendApplyMapper {

    /**
      * 新增
    */
    int insert(FriendApply friendApply);

    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(FriendApply friendApply);

    /**
      * 根据ID查询
    */
    FriendApply selectById(Integer id);

    /**
      * 查询所有
    */
    List<FriendApply> selectAll(FriendApply friendApply);

    @Select("select * from friend_list where user_id = #{userId} and friend_id = #{applyUserId}")
    FriendApply selectByUserIdAndApplyId(Integer userId, Integer applyUserId);

    @Select("select * from friend_apply where user_id = #{id}")
    List<FriendApply> selectByUserId(Integer id);

    @Select("select * from friend_apply where apply_user_id = #{id}")
    List<FriendApply> selectByApplyUserId(Integer id);
}